from pymysql import Connection

# 创建连接
conn = Connection(
    host='localhost',
    port=3306,
    user='root',
    password='success'
)

# 获取数据库信息
print(conn.get_server_info())

# 使用python创建表
cursor = conn.cursor()  # 获取游标对象
conn.select_db('student')
# cursor.execute('create table test_pymysql(id int);')

# 查询表中数据
cursor.execute('select * from student')
results = cursor.fetchall()
for item in results:
    print(item)

conn.close()
